<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function changeCode(){
            //得到图片对象
            var imgObj = document.getElementById("codeImg");
            imgObj.src = "/checkCode?"+Math.random();
        }
    </script>
</head>
<body>
    用户名： <input type="text" name="userName"><br>
    密码：<input type="password" name="pwd"><br>
    验证码：<img src="/checkCode" id="codeImg">
    <a href="javascript:changeCode()">看不清楚换一张</a>
</body>
</html>